<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>基于 RN 的极简社区页面模版</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="RN,RN,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" href="{{asset('user/layui/css/layui.css')}}">
    <link rel="stylesheet" href="{{asset('user/css/global.css')}}">
    <script  src="{{asset('js/vue.min.js')}}"></script>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
    <script  src="{{asset('js/public.js')}}"></script>

    <script src="{{asset('user/layui/layui.js')}}"></script>
</head>
<body>

<div class="header" id="header">
    <div class="main">
        <a class="logo" href="/" title="Fly">Fly社区</a>
        <div class="nav">
            <a :class="{'nav-this':section_id==''}"  href="/">
                {{--<i class="iconfont icon-wenda"></i>--}}<span>首页</span>
            </a>
            <a :class="{'nav-this':item.section_id==section_id}" v-for="(item,index) in data"   :href="'?cate='+item.section_id">
                {{--<i class="iconfont icon-wenda"></i>--}}<span v-text="item.section_name"></span>
            </a>
        </div>

        <div class="nav-user">
            <!-- 未登入状态 -->
            @if(!Session::has('user_info'))
            <a class="unlogin" href="{{url('user/login/index')}}"><i class="iconfont icon-touxiang"></i></a>
            <span><a href="{{url('user/login/index')}}">登入</a>{{--<a href="{{url('user/reg')}}">注册</a>--}}</span>
            <p class="out-login">
                <a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
                <a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
            </p>
            @endif
            <!-- 登入后的状态 -->
            @if(Session::has('user_info'))
            <a class="avatar" href="{{url('user/home')}}">
              <img src="http://tp4.sinaimg.cn/1345566427/180/5730976522/0">
              <cite>{{Session::get('user_info')['user_name']}}</cite>
            {{--  <i>VIP2</i>--}}
            </a>
            <div class="nav">
              <a href="{{url('user/home/set')}}"><i class="iconfont icon-shezhi"></i>设置</a>
            </div>
            @endif
        </div>
    </div>
</div>
<script>
    $("input").focus(function(){
        $(".alert-danger").hide();
    });
/*    $(".icon-sousuo").click(function(){
        alert(2);
        $(".home_search").submit();
    });*/

    var menu=new Vue({
        el:'#header',
        data:{
            data:'',
            section_id:getUrlParam('cate')?getUrlParam('cate'):''
        },
        methods:{
            get_menue:function() {
                $.ajax( {
                    url:'/api/menu',
                    data:{},
                    type:'post',
                    cache:false,
                    dataType:'json',
                    success:function(data) {
                       menu.data=data.data.data;
                    },
                    error : function() {
                        alert("异常！");
                    }
                })
            }
        },
        created:function(){
         this.get_menue();
        },
        updated:function(){
            $('#pay_success').show()
        },
        mounted:function () {
            
        }
    })
</script>